package exception;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        try {
     /*       String s=null;
            System.out.println(s.length());
            String str="abc";
            System.out.println(str.charAt(5));
            */
            String str="abcc";
            System.out.println(Integer.parseInt(str));
        }catch (NullPointerException e){
            System.out.println("出现空指针异常,并处理完毕了");
        }
        catch (StringIndexOutOfBoundsException a)
        {
            System.out.println("出现了字符串下标越界异常，并处理完毕了");
        }
        catch (Exception    e)
        {
            System.out.println("出现了未知错误");
        }
        System.out.println("程序结束了");
    }
}
